from pydantic_settings import BaseSettings
from pydantic_settings import SettingsConfigDict


class Settings(BaseSettings):
    # 应用配置
    APP_NAME: str = "My FastAPI App"
    DEBUG: bool = False
    RAG_HOST:str = "http://192.168.1.111:1602"
    # 数据库配置
    MONGODB_URL: str = "mongodb://192.168.1.111:27017"
    DB_NAME: str = "qnn"

    # JWT 配置
    SECRET_KEY: str
    ALGORITHM: str = "HS256"
    ACCESS_TOKEN_EXPIRE_MINUTES: int = 300

    # 微信配置
    BASE_KEY: str = "12345"
    BASE_IP: str = "192.168.1.218"
    BASE_PORT : str= "1238"
    BASE_URL: str = F"http://{BASE_IP}:{BASE_PORT}"

    #RabbitMQ配置
    RABBITMQ_HOST: str = "8.155.160.155"
    # RABBITMQ_HOST: str = "192.168.1.85"

    RAG_URL:str = RAG_HOST + "/api/v1/query"

    #RabbitMQ配置
    RABBITMQ_PORT: int = 5672
    RABBITMQ_USERNAME: str = "admin"
    RABBITMQ_PASSWORD: str = "111111"
    #REDIS配置
    REDIS_HOST: str = "127.0.0.1"
    # REDIS_HOST: str = "8.155.160.155"
    REDIS_PORT: int = 6379
    REDIS_PASSWORD:str = "123456"
    REDIS_DB: int = 0
    REDIS_DB_TASK: int = 1
    REDIS_LABEL_KEY : str = "lable_list_cache"
    REDIS_TTL : int= 60 * 60 * 12  # 12 小时，单位秒

    #AI模型识别配置
    BD_OCR_API_URL:str ="https://aip.baidubce.com/rest/2.0/ocr/v1/table"
    BD_API_ACCESS_TOKEN:str = "24.ded3ac6bb35dc4ef9c5724d1edcc3586.2592000.1758786428.282335-119606314"

    #webhook配置
    WEBHOOK_SECRET: str = "999222"
    model_config = SettingsConfigDict(env_file=".env", extra="ignore")

    #MINIO配置
    MINIO_ENDPOINT: str = "8.155.160.155:9000"
    MINIO_ACCESS_KEY: str = "minioadmin"
    MINIO_SECRET_KEY: str = "qnnminioadmin"

    #企业微信回调配置
    QW_TOKEN: str = "RSfFDFBUpdsnd"
    QW_SECRET: str = "sBcGLOfHFMFTq3vcOQwYxMf6Xmsgc4ZC4pdwEqQFGyq"
    # QW_APP_ID: str = "ww4e1dee4d5fb2a845"
    QW_APP_ID: str = "ww41737c0a8bdce8c3"
    # QW_KF_SECRET: str = "dp5tOgasMNRVrtKN8mg9GSa5GVpJaFTQF8BG-vLeKn0"
    QW_KF_SECRET: str = "WNdLdCxOj6MNzevOrySwttCbo-nbZAk4oOl46PgjjAk"

    # 阿里云语音识别合成配置
    ALI_APP_KEY: str = "cstyivhmc10edfh4"
    ALI_ACCESS_KEY_ID: str = "LTAI5tDzR7mD7VPmg3HwsPVM"
    ALI_ACCESS_KEY_SECRET: str = "QX4DAzoaqG1Zp8nUBFhnM3QQyutpfn"
# 创建全局配置实例
settings = Settings()
